/*
  Copyright 2011 The Rhizosphere Authors. All Rights Reserved.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/

package com.rhizospherejs.gwt.client.resources;

/**
 * DOM injector for Rhizosphere resources (Javascript and styles).
 *
 * Resource injection might be tricky
 *
 * @author battlehorse@google.com (Riccardo Govoni)
 */
public interface ResourcesInjector {

  /**
   * Injects the styles required by Rhizosphere dependencies (like jQuery UI)
   * into the GWT host page.
   * 
   * @param theme The visual theme to use.
   */
  void injectDependenciesCss(String theme);

  /**
   * Injects the styles required by Rhizosphere into the GWT host page.
   * 
   * @param theme The visual theme to use.
   */
  void injectRhizoCss(String theme);

  /**
   * Injects the javascript libraries Rhizosphere depends upon into the
   * GWT host page.
   *
   * @param callback A callback invoked after all the dependencies have been
   *     successfully injected and parsed by the browser.
   * @param useGoogleCDN Whether to load dependencies from Google CDN
   *     (http://code.google.com/apis/libraries/) rather than from the local
   *     GWT deployment.
   */
  void injectDependenciesJavascript(Runnable callback, boolean useGoogleCDN);

  /**
   * Inject the Rhizosphere Javascript libraries into the GWT host page.
   *
   * @param callback A callback invoked after all the libraries have been
   *     successfully injected and parsed by the browser.
   */
  void injectRhizoJavascript(Runnable callback);
}
